Stack_Pointer		EQU		0D0H
			SEGA		BIT		P6.0
			SEGB		BIT		P6.1
			SEGC		BIT		P6.2
			SEGD		BIT		P6.3
			SEGE		BIT		P6.4
			SEGF		BIT		P6.5
			SEGG		BIT		P6.6
			SEGDOP		BIT		P6.7
			DIS_BLACK	EQU		10H
			P0M1		DATA		0x93
			P0M0		DATA		0x94
			P1M1		DATA		0x91
			P1M0		DATA		0x92
			P2M1		DATA		0x95
			P2M0		DATA		0x96
			P3M1		DATA		0xB1
			P3M0		DATA		0xB2
			P4M1		DATA		0xB3
			P4M0		DATA		0xB4
			P5M1		DATA		0xC9
			P5M0		DATA		0xCA
			P6M1		DATA		0xCB
			P6M0		DATA		0xCC
			P7M1		DATA		0xE1
			P7M0		DATA		0xE2
			AUXR		DATA		8EH
			P4			DATA		0C0H
			P5			DATA		0C8H
			P6			DATA		0E8H
			P7			DATA		0F8H
				
			;IO口定义
			
			P_HC595_SER		BIT		P4.4
			P_HC595_SRCLK	BIT		P4.2
			P_HC595_RCLK	BIT		P4.3
			Control1		BIT		P4.0
			;本地变量生声明
			
			ZHONGLED8		DATA		30H
			GUOLED8			DATA		38H
			KUANGLED8		DATA		40H
			YELED8			DATA		48H
			DALED8			DATA		50H
			XUELED8			DATA		58H
			DIANLED8		DATA		20H
			QILED8			DATA		28H
			YUANLED8		DATA		70H
			XULED8			DATA		60H
			HAILED8			DATA		68H
			display_index1	DATA		7FH
			
			;主程序
			ORG		0000H
			LJMP	F_Main
			ORG		0050H
F_Main: 	CLR		A
			MOV		P0M1,A
			MOV		P0M0,A
			MOV		P1M1,A
			MOV		P1M0,A
			MOV		P2M1,A
			MOV		P2M0,A
			MOV		P3M1,A
			MOV		P3M0,A
			MOV		P4M1,A
			MOV		P4M0,#01H
			MOV		P5M1,A
			MOV		P5M0,A
			MOV		P6M1,A
			MOV		P6M0,A
			MOV		P7M1,A
			MOV		P7M0,A
			MOV		SP, #Stack_Pointer
			MOV		PSW, #00H
			SETB	Control1
			;初始化程序
			MOV		ZHONGLED8, #0FFH
			MOV		ZHONGLED8+1, #0E3H
			MOV		ZHONGLED8+2, #0EBH
			MOV		ZHONGLED8+3, #0EBH
			MOV		ZHONGLED8+4, #00H
			MOV		ZHONGLED8+5, #0EBH
			MOV		ZHONGLED8+6, #0EBH
			MOV		ZHONGLED8+7, #0E3H
			
			MOV		GUOLED8, #0FFH
			MOV		GUOLED8+1, #00H
			MOV		GUOLED8+2, #2AH
			MOV		GUOLED8+3, #0AH
			MOV		GUOLED8+4, #02H
			MOV		GUOLED8+5, #2AH
			MOV		GUOLED8+6, #2AH
			MOV		GUOLED8+7, #00H
			
			MOV		KUANGLED8, #0FDH
			MOV		KUANGLED8+1, #0FDH
			MOV		KUANGLED8+2, #0FCH
			MOV		KUANGLED8+3, #01H
			MOV		KUANGLED8+4, #0DH
			MOV		KUANGLED8+5, #69H
			MOV		KUANGLED8+6, #05H
			MOV		KUANGLED8+7, #0EDH
			
			MOV		YELED8, #7BH
			MOV		YELED8+1, #77H
			MOV		YELED8+2, #6FH
			MOV		YELED8+3, #01H
			MOV		YELED8+4, #7FH
			MOV		YELED8+5, #01H
			MOV		YELED8+6, #06FH
			MOV		YELED8+7, #77H
			
			MOV		DALED8, #0FFH
			MOV		DALED8+1, #7BH
			MOV		DALED8+2, #0BBH
			MOV		DALED8+3, #0DBH
			MOV		DALED8+4, #0E0H
			MOV		DALED8+5, #0DBH
			MOV		DALED8+6, #0BBH
			MOV		DALED8+7, #07BH
			
			MOV		XUELED8, #0D3H
			MOV		XUELED8+1, #0DAH
			MOV		XUELED8+2, #0D1H
			MOV		XUELED8+3, #0C3H
			MOV		XUELED8+4, #01H
			MOV		XUELED8+5, #52H
			MOV		XUELED8+6, #99H
			MOV		XUELED8+7, #0D2H
			
			MOV		DIANLED8, #0BFH
			MOV		DIANLED8+1, #41H
			MOV		DIANLED8+2, #55H
			MOV		DIANLED8+3, #55H
			MOV		DIANLED8+4, #00H
			MOV		DIANLED8+5, #0D5H
			MOV		DIANLED8+6, #0D5H
			MOV		DIANLED8+7, #0C1H
			
			MOV		QILED8, #75H
			MOV		QILED8+1, #61H
			MOV		QILED8+2, #51H
			MOV		QILED8+3, #31H
			MOV		QILED8+4, #71H
			MOV		QILED8+5, #70H
			MOV		QILED8+6, #0FDH
			MOV		QILED8+7, #0FBH
			
			MOV		YUANLED8, #61H
			MOV		YUANLED8+1, #05H
			MOV		YUANLED8+2, #0E5H
			MOV		YUANLED8+3, #04H
			MOV		YUANLED8+4, #61H
			MOV		YUANLED8+5, #0F4H
			MOV		YUANLED8+6, #0F2H
			MOV		YUANLED8+7, #02H
			
			;主循环
L_Main_Loop: 
			MOV		R0,  #ZHONGLED8
			MOV		R2,#00H
ZhongLoop:	LCALL	F_DisplayScan1
			LCALL	F_Delay_2ms
			DJNZ	R2, ZhongLoop
			
			MOV		R0,  #GUOLED8
			MOV		R2,#00H
GuoLoop:	LCALL	F_DisplayScan1
			LCALL	F_Delay_2ms
			DJNZ	R2, GuoLoop
			
			MOV		R0,  #KUANGLED8
			MOV		R2,#00H
KuangLoop:	LCALL	F_DisplayScan1
			LCALL	F_Delay_2ms
			DJNZ	R2, KuangLoop
			
			MOV		R0,  #YELED8
			MOV		R2,#00H
YeLoop:	LCALL	F_DisplayScan1
			LCALL	F_Delay_2ms
			DJNZ	R2, YeLoop
			
			MOV		R0,  #DALED8
			MOV		R2,#00H
DaLoop:	LCALL	F_DisplayScan1
			LCALL	F_Delay_2ms
			DJNZ	R2, DaLoop
			
			MOV		R0,  #XUELED8
			MOV		R2,#00H
XueLoop:	LCALL	F_DisplayScan1
			LCALL	F_Delay_2ms
			DJNZ	R2, XueLoop
			
			MOV		R0,  #DIANLED8
			MOV		R2,#00H
DianLoop:	LCALL	F_DisplayScan1
			LCALL	F_Delay_2ms
			DJNZ	R2, DianLoop
			
			MOV		R0,  #QILED8
			MOV		R2,#00H
LiLoop:	LCALL	F_DisplayScan1
			LCALL	F_Delay_2ms
			DJNZ	R2, LiLoop
			
			MOV		R0,  #XUELED8
			MOV		R2,#00H
XueLoop1:	LCALL	F_DisplayScan1
			LCALL	F_Delay_2ms
			DJNZ	R2, XueLoop1
			
			MOV		R0,  #YUANLED8
			MOV		R2,#00H
YuanLoop:	LCALL	F_DisplayScan1
			LCALL	F_Delay_2ms
			DJNZ	R2, YuanLoop
			
			MOV		R0,  #XULED8
			MOV		R2,#00H
			
			LJMP	L_Main_Loop
			
			
T_Display:
			DB	3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH
			DB	6FH,77H,7CH,39H,5EH,79H,71H
			DB	00H,40H,76H,1EH,70H,38H,37H,5CH,73H
			DB	3EH,78H,3DH,67H,50H,37H,6EH

T_COM: 		DB	01H,02H,04H,08H,10H,20H,40H,80H
	
			;函数F_Send_595
			
F_Send_595: 	PUSH	02H
			MOV		R2,#8
			L_Send_595_Loop:
			RLC		A
			MOV		P_HC595_SER, C
			SETB	P_HC595_SRCLK
			CLR		P_HC595_SRCLK
			DJNZ	R2, L_Send_595_Loop
			POP		02H
			RET
			
			;函数F_DisplayScan1
F_DisplayScan1:
			PUSH	DPH
			PUSH	DPL
			 
			MOV		DPTR, #T_COM
			MOV		A, display_index1
			MOVC	A, @A+DPTR
			NOP
			LCALL	F_Send_595
			CLR		A
			LCALL	F_Send_595
			SETB	P_HC595_RCLK
			CLR		P_HC595_RCLK
			
			MOV		A,@R0
			MOV		P6, A
			INC		R0
			INC		display_index1
			MOV		A,display_index1
			ANL 	A, #0F8H
			JZ		L_QuitDisplayScan1
			MOV		display_index1, #0
			MOV		A, R0
			CLR		C
			SUBB	A, #08H
			MOV		R0, A
L_QuitDisplayScan1:	 
			POP		DPL
			POP		DPH
			RET
				
			;延时子程序
F_Delay_2ms:PUSH	03H
			 PUSH	04H
			 MOV	R3,#100
			MOV		R4,#248
NEXT:		DJNZ	R4, NEXT
			DJNZ	R3, NEXT
			NOP
			NOP
			POP		04H
			POP		03H
			RET
			END
